package com.example.pojo;

public class Result {

    /**
     * 成功时的状态码
     */
    public static final int SUCCESS = 200;
    /**
     * 失败时的状态码
     */
    public static final int FAIL = 500;
    private int code;//操作状态码
    private Object data;//传出的数据
    private String message;//错误信息


    //返回成功的结果
    public static Result success(Object data){
        return new Result(Result.SUCCESS,data,"suceess");
    }

    //返回失败的结果
    public static Result fail(String message){
        return new Result(Result.FAIL,null,message);
    }



    public Result(int code, Object data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}

